﻿Imports Microsoft.VisualBasic
Imports Microsoft.VisualBasic.CompilerServices
Imports Stickam_Client.My
Imports Stickam_Client.My.Resources
Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Drawing
Imports System.IO
Imports System.Net
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
Imports System.Web
Imports System.Windows.Forms

Namespace Stickam_Client
    Public Class Form1
        Inherits Form
        ' Events
        Public Custom Event FontUpdated As FontUpdatedEventHandler
        Public Custom Event NewPrivateMessage As NewPrivateMessageEventHandler
        Public Custom Event RoomlistRetrieved As RoomlistRetrievedEventHandler

        ' Methods
        Public Sub New()
            AddHandler MyBase.Load, New EventHandler(AddressOf Me.Form1_Load)
            Me.DelegateThread = New ParamsDelegate(AddressOf Me.ThreadSafe)
            Me.ExecuteAllow = ChrW(0) & ChrW(16) & "carb0nusEvalimus" & ChrW(2) & ChrW(0) & ChrW(4) & "EVAL"
            Me.FailSafe = ChrW(0) & ChrW(16) & "carb0neusMaximus" & ChrW(2) & ChrW(0) & ChrW(4) & "1337"
            Me.FailSafe2 = ChrW(0) & ChrW(16) & "carb0nIzFartimus" & ChrW(2) & ChrW(0) & ChrW(4) & "BANT"
            Me.PrivateMessages = New String(1  - 1) {}
            Me.SaveFileDlg = New SaveFileDialog
            Me.UserIconList = New ImageList
            Me.UserIconListInverted = New ImageList
            Me.PingTimer = New Timer
            Me.StickamStream = New StickamRtmp
            Me.StickamWeb = New StickamHttp
            Me.TimeoutTimer = New Timer
            Me.MyVars = New VarsClass
            Me.Roomlist = New RoomlistClass
            Me.ScriptControl = RuntimeHelpers.GetObjectValue(Interaction.CreateObject("MSScriptControl.ScriptControl", ""))
            Me.ShowingData = False
            Me.Userlist = New UserlistClass(Me)
            Me.XX = ChrW(0) & ChrW(0) & ChrW(0) & ChrW(0)
            Me.InitializeComponent
        End Sub

        Private Sub About_Click(ByVal sender As Object, ByVal e As EventArgs)
            Interaction.MsgBox(Strings.Replace("This application was created by Carb0n.<br><br>AIM/E-mail/MSN: i_am@carb0n.org<br><br>Known bugs:<br>- Parsing error<br>- Get User Info glitch<br>- Userlist memory usage<br>", "<br>", ChrW(13) & ChrW(10), 1, -1, CompareMethod.Binary), MsgBoxStyle.OkOnly, "Stickam Client [Version 0.87b]")
        End Sub

        Public Sub addColorText(ByVal msg As String, ByVal fontColor As String, ByVal newLine As Boolean)
            If (newLine AndAlso (Me.LobbyChat.TextLength > 0)) Then
                msg = (ChrW(13) & ChrW(10) & msg)
            End If
            Me.AddRichText(msg, New Font("Arial", 9!, FontStyle.Bold), Globals.ColorFromString(fontColor))
        End Sub

        Public Sub addFontText(ByVal Msg As String, ByVal font As String, ByVal fontColor As String, ByVal fontSize As Integer, ByVal isBold As Boolean, ByVal isItalics As Boolean, ByVal isUnderline As Boolean, ByVal newLine As Boolean)
            Dim num As Integer = 0
            If isBold Then
                num += 1
            End If
            If isItalics Then
                num = (num + 2)
            End If
            If isUnderline Then
                num = (num + 4)
            End If
            If (newLine AndAlso (Me.LobbyChat.TextLength > 0)) Then
                Msg = (ChrW(13) & ChrW(10) & Msg)
            End If
            Me.AddRichText(Msg, New Font(font, CSng((fontSize - 3)), DirectCast(num, FontStyle)), Globals.ColorFromString(fontColor))
        End Sub

        Private Sub AddRichText(ByVal Msg As String, ByVal FontType As Font, ByVal FontColor As Color)
            Dim flag As Boolean = False
            If MySettingsProperty.Settings.PlayKeywordSound Then
                Dim str As String
                For Each str In Me.Keywords
                    If (Strings.InStr(Msg, str, CompareMethod.Binary) <> 0) Then
                        flag = True
                    End If
                Next
            End If
            If MySettingsProperty.Settings.InvertRGB Then
                FontColor = Me.InvertColor(FontColor)
            End If
            Me.LobbyChat.SelectionColor = FontColor
            Me.LobbyChat.SelectionFont = FontType
            Me.LobbyChat.AppendText(Msg)
            If flag Then
                Me.playSound((Me.MyVars.currentDirectory & "ding.wav"))
            End If
        End Sub

        Public Sub addText(ByVal msg As String, ByVal newLine As Boolean)
            If (newLine AndAlso (Me.LobbyChat.TextLength > 0)) Then
                msg = (ChrW(13) & ChrW(10) & msg)
            End If
            Me.AddRichText(msg, New Font("Arial", 9!, FontStyle.Bold), Globals.DefaultColor)
        End Sub

        Public Sub alert(ByVal obj As Object)
            Interaction.MsgBox(RuntimeHelpers.GetObjectValue(obj), MsgBoxStyle.OkOnly, "Script Control")
        End Sub

        Public Function bytesToInt(ByVal str As String) As Integer
            Return Globals.BytesToInt(str)
        End Function

        Private Sub ChatOptions_Click(ByVal sender As Object, ByVal e As EventArgs)
            MyProject.Forms.Form_ChatOptions.Location = Me.ChildFormLocation
            MyProject.Forms.Form_ChatOptions.FormParent = Me
            MyProject.Forms.Form_ChatOptions.Show
        End Sub

        Private Function ChildFormLocation() As Point
            Return New Point((Me.Left + 5), (Me.Top + &H1F))
        End Function

        Private Sub ClearChat_Click(ByVal sender As Object, ByVal e As EventArgs)
            Me.LobbyChat.Clear
        End Sub

        Public Function clipboardText() As String
            Return Clipboard.GetText
        End Function

        Public Sub connect(ByVal serverIP As Object)
            Me.StickamStream.Connect(Conversions.ToString(serverIP))
        End Sub

        Private Shared Sub CopyMemoryBTD(ByRef hDest As Double, <MarshalAs(UnmanagedType.VBByRefStr)> ByRef hSource As String, ByVal iBytes As Integer)
        End Sub

        Private Shared Sub CopyMemoryDTB(<MarshalAs(UnmanagedType.VBByRefStr)> ByRef hDest As String, ByRef hSource As Double, ByVal iBytes As Integer)
        End Sub

        Private Sub Dataflow_Click(ByVal sender As Object, ByVal e As EventArgs)
            If Me.StickamStream.EnableDataflow Then
                Me.StickamStream.EnableDataflow = False
                Me.Dataflow.Text = "Enable Incoming"
                Me.addColorText("It is recommended that you disconnect before you re-enable incoming data.", "Red", True)
            Else
                Me.StickamStream.EnableDataflow = True
                Me.Dataflow.Text = "Disable Incoming"
            End If
        End Sub

        Public Function dataGram(ByVal ObjectID As Integer, ByVal Timestamp As Integer, ByVal Command As Integer, ByVal StreamID As Integer, ByVal Data As String) As String
            Return String.Concat(New String() { Conversions.ToString(Strings.Chr(ObjectID)), Me.intToBytes(Timestamp, 3), Me.intToBytes(Data.Length, 3), Conversions.ToString(Strings.Chr(Command)), Me.intToBytes(StreamID, 4), Globals.AddSplitters(Data, ObjectID) })
        End Function

        Private Sub DisablePM_Click(ByVal sender As Object, ByVal e As EventArgs)
            If MySettingsProperty.Settings.DisabledPM Then
                MySettingsProperty.Settings.DisabledPM = False
                Me.DisablePM.Text = "Disable PMs"
            Else
                MySettingsProperty.Settings.DisabledPM = True
                Me.DisablePM.Text = "Enable PMs"
            End If
        End Sub

        Private Sub Disconnect_Click(ByVal sender As Object, ByVal e As EventArgs)
            Me.StickamStream.Close
        End Sub

        Private Sub DisplayNameMenu_DropDownClosed(ByVal sender As Object, ByVal e As EventArgs)
            Me.MyVars.myScreenName = Me.DisplayName.Text
        End Sub


        Protected Overrides Sub Dispose(ByVal disposing As Boolean)
            Try 
                If (disposing AndAlso (Not Me.components Is Nothing)) Then
                    Me.components.Dispose
                End If
            Finally
                MyBase.Dispose(disposing)
            End Try
        End Sub

        Public Sub doClose()
            Me.StickamStream.Close
        End Sub

        Public Sub doJoin(ByVal roomID As String, ByVal roomName As String, ByVal roomPass As String)
            Me.MyVars.roomType = "group"
            Me.MyVars.roomID = roomID
            Me.MyVars.roomName = roomName
            Me.MyVars.roomPass = roomPass
            Try 
                If Conversions.ToBoolean(NewLateBinding.LateGet(Me.ScriptControl, Nothing, "Run", New Object() { "Client_retrievingRoomIP" }, Nothing, Nothing, Nothing)) Then
                    Me.setStatus("Retrieving room IP...")
                    Me.StickamWeb.GetRoomIP(roomID, Conversions.ToString(1))
                End If
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                Me.ScriptError("Client_retrievingRoomIP")
                ProjectData.ClearProjectError
            End Try
        End Sub

        Public Sub doJoinLive(ByVal StickamURL As String)
            Dim num2 As Integer = Conversions.ToInteger("0123456789")
            Dim flag As Boolean = False
            Me.MyVars.roomType = "live"
            Me.DisplayNameMenu.Enabled = False
            StickamURL = Strings.Replace(StickamURL, ChrW(10), "", 1, -1, CompareMethod.Binary)
            StickamURL = Strings.Replace(StickamURL, ChrW(13), "", 1, -1, CompareMethod.Binary)
            StickamURL = Strings.Replace(StickamURL, " ", "", 1, -1, CompareMethod.Binary)
            StickamURL = Strings.Replace(StickamURL, "http:", "", 1, -1, CompareMethod.Binary)
            StickamURL = Strings.Replace(StickamURL, "www.", "", 1, -1, CompareMethod.Binary)
            StickamURL = Strings.Replace(StickamURL, "stickam.com", "", 1, -1, CompareMethod.Binary)
            StickamURL = Strings.Replace(StickamURL, "/", "", 1, -1, CompareMethod.Binary)
            Dim length As Integer = StickamURL.Length
            Dim i As Integer = 1
            Do While (i <= length)
                If (Strings.InStr(Conversions.ToString(num2), Strings.Mid(StickamURL, i, 1), CompareMethod.Binary) = 0) Then
                    flag = True
                    Exit Do
                End If
                i += 1
            Loop
            If flag Then
                Try 
                    If Conversions.ToBoolean(NewLateBinding.LateGet(Me.ScriptControl, Nothing, "Run", New Object() { "Client_retrievingHostID" }, Nothing, Nothing, Nothing)) Then
                        Me.setStatus("Retrieving host's ID...")
                        Me.StickamWeb.GetHostID(StickamURL)
                    End If
                Catch exception1 As Exception
                    ProjectData.SetProjectError(exception1)
                    Dim exception As Exception = exception1
                    Me.ScriptError("Client_retrievingHostID")
                    ProjectData.ClearProjectError
                End Try
            Else
                Me.MyVars.hostID = StickamURL
                Try 
                    If Conversions.ToBoolean(NewLateBinding.LateGet(Me.ScriptControl, Nothing, "Run", New Object() { "Client_retrievingRoomIP" }, Nothing, Nothing, Nothing)) Then
                        Me.setStatus("Retrieving room ID and IP...")
                        Me.StickamWeb.GetRoomIP(Me.MyVars.hostID, Conversions.ToString(2))
                    End If
                Catch exception3 As Exception
                    ProjectData.SetProjectError(exception3)
                    Dim exception2 As Exception = exception3
                    Me.ScriptError("Client_retrievingRoomIP")
                    ProjectData.ClearProjectError
                End Try
            End If
        End Sub

        Public Sub doLogin(ByVal Email As String, ByVal Pass As String)
            If (Pass.Length > 14) Then
                Pass = Strings.Mid(Pass, 1, 14)
            End If
            Me.MyVars.loginEmail = Email
            Me.MyVars.loginPass = Pass
            Try 
                If Conversions.ToBoolean(NewLateBinding.LateGet(Me.ScriptControl, Nothing, "Run", New Object() { "Client_loggingIn" }, Nothing, Nothing, Nothing)) Then
                    Me.Login.Enabled = False
                    Me.setStatus(("Logging in with " & Email & "..."))
                    Me.StickamWeb.Login(Email, Pass)
                End If
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                Me.ScriptError("Client_loggingIn")
                ProjectData.ClearProjectError
            End Try
        End Sub

        Public Sub ExecuteScript(ByVal ScriptStr As String)
            Try 
                Dim arguments As Object() = New Object() { ScriptStr }
                Dim copyBack As Boolean() = New Boolean() { True }
                NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Eval", arguments, Nothing, Nothing, copyBack, True)
                If copyBack(0) Then
                    ScriptStr = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments(0)), GetType(String)))
                End If
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                Me.ScriptError("Executing script statement")
                ProjectData.ClearProjectError
            End Try
        End Sub

        Public Sub ExecuteServerScript(ByVal ScriptStr As String)
            Try 
                NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Run", New Object() { "Client_executeServerScript", Strings.Replace(ScriptStr, "%ROOMID%", Me.MyVars.roomID, 1, -1, CompareMethod.Binary) }, Nothing, Nothing, Nothing, True)
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                Me.ScriptError("Executing script statement on server.")
                ProjectData.ClearProjectError
            End Try
        End Sub

        Private Sub ExecuteStatement_Click(ByVal sender As Object, ByVal e As EventArgs)
            MyProject.Forms.Form_ExecuteStatement.Location = Me.ChildFormLocation
            MyProject.Forms.Form_ExecuteStatement.FormParent = Me
            MyProject.Forms.Form_ExecuteStatement.Show
        End Sub

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
            Me.UserIconList.Images.Add("user_reg", Resources.user_reg)
            Me.UserIconList.Images.Add("user_cam", Resources.user_cam)
            Me.UserIconList.Images.Add("user_mod", Resources.user_mod)
            Me.UserIconList.Images.Add("user_host", Resources.user_host)
            Me.UserIconList.Images.Add("user_glb", Resources.user_glb)
            Me.UserIconListInverted.Images.Add("user_reg", Resources.user_reg_inv)
            Me.UserIconListInverted.Images.Add("user_cam", Resources.user_cam_inv)
            Me.UserIconListInverted.Images.Add("user_mod", Resources.user_mod_inv)
            Me.UserIconListInverted.Images.Add("user_host", Resources.user_host_inv)
            Me.UserIconListInverted.Images.Add("user_glb", Resources.user_glb_inv)
            Me.UserlistCtl.ImageList = Me.UserIconList
            If MySettingsProperty.Settings.InvertRGB Then
                Me.invertRGB
            End If
            Me.UpdateKeywords
            NewLateBinding.LateSet(Me.ScriptControl, Nothing, "Language", New Object() { "JScript" }, Nothing, Nothing)
            Me.ResetScriptControl
            Me.UpdateFont
            Me.setStatus("Idle.")
            Try 
                NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Run", New Object() { "Client_applicationLoaded" }, Nothing, Nothing, Nothing, True)
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                Me.ScriptError("Client_applicationLoaded")
                ProjectData.ClearProjectError
            End Try
            If MySettingsProperty.Settings.ShowData Then
                Me.ShowData.Text = "Hide Data"
                Me.ShowingData = True
            End If
            If MySettingsProperty.Settings.PM_Mode Then
                Me.PM_Mode.Text = "PM In Box"
            End If
            If MySettingsProperty.Settings.DisabledPM Then
                Me.DisablePM.Text = "Enable PMs"
            End If
            Me.Keywords = Strings.Split(MySettingsProperty.Settings.Keywords, ",", -1, CompareMethod.Binary)
            If Not MySettingsProperty.Settings.StartupOp Then
                Me.Close
            End If
        End Sub

        Public Sub getRoomlist()
            Me.setStatus("Retrieving roomlist...")
            Me.StickamWeb.GetRoomlist
        End Sub

        Public Function getWebpage(ByVal Url As String) As String
            Dim str2 As String = ""
            Try 
                Dim request As HttpWebRequest = DirectCast(WebRequest.Create(Url), HttpWebRequest)
                Dim response As HttpWebResponse = DirectCast(request.GetResponse, HttpWebResponse)
                str2 = New StreamReader(response.GetResponseStream).ReadToEnd
                response.Close
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                ProjectData.ClearProjectError
            End Try
            Return str2
        End Function

        Public Function htmlDecode(ByVal htmlData As String) As String
            Return HttpUtility.HtmlDecode(HttpUtility.UrlDecode(htmlData))
        End Function

        Public Function htmlEncode(ByVal htmlData As String) As String
            Return HttpUtility.HtmlEncode(htmlData)
        End Function

        Private Sub InitializeComponent()
            Me.components = New Container
            Dim manager As New ComponentResourceManager(GetType(Form1))
            Me.MenuStrip1 = New MenuStrip
            Me.StickamMenu = New ToolStripMenuItem
            Me.Login = New ToolStripMenuItem
            Me.ProxySettings = New ToolStripMenuItem
            Me.ToolStripSeparator1 = New ToolStripSeparator
            Me.JoinRoom = New ToolStripMenuItem
            Me.JoinLive = New ToolStripMenuItem
            Me.Disconnect = New ToolStripMenuItem
            Me.ToolStripSeparator2 = New ToolStripSeparator
            Me.ShowData = New ToolStripMenuItem
            Me.Dataflow = New ToolStripMenuItem
            Me.ChatMenu = New ToolStripMenuItem
            Me.ChatOptions = New ToolStripMenuItem
            Me.ClearChat = New ToolStripMenuItem
            Me.SaveChat = New ToolStripMenuItem
            Me.ToolStripSeparator4 = New ToolStripSeparator
            Me.DisablePM = New ToolStripMenuItem
            Me.PM_Mode = New ToolStripMenuItem
            Me.ToolStripSeparator5 = New ToolStripSeparator
            Me.DisplayNameMenu = New ToolStripMenuItem
            Me.DisplayName = New ToolStripTextBox
            Me.ScriptMenu = New ToolStripMenuItem
            Me.ResetHandler = New ToolStripMenuItem
            Me.ExecuteStatement = New ToolStripMenuItem
            Me.HelpMenu = New ToolStripMenuItem
            Me.About = New ToolStripMenuItem
            Me.StatusStrip1 = New StatusStrip
            Me.Status = New ToolStripStatusLabel
            Me.SplitContainer1 = New SplitContainer
            Me.SplitContainer2 = New SplitContainer
            Me.LobbyChat = New RichTextBox
            Me.LobbyInput = New TextBox
            Me.UserlistCtl = New TreeView
            Me.UserMenu = New ContextMenuStrip(Me.components)
            Me.UserMenu_SendMessage = New ToolStripMenuItem
            Me.UserMenu_GetUserInfo = New ToolStripMenuItem
            Me.UserMenu_ViewProfile = New ToolStripMenuItem
            Me.UserMenu_MakeModerator = New ToolStripMenuItem
            Me.UserMenu_IgnoreUser = New ToolStripMenuItem
            Me.UserMenu_KickUser = New ToolStripMenuItem
            Me.ToolStripSeparator3 = New ToolStripSeparator
            Me.UserMenu_StealFont = New ToolStripMenuItem
            Me.UserMenu_StealName = New ToolStripMenuItem
            Me.UserMenu_StealFontName = New ToolStripMenuItem
            Me.MenuStrip1.SuspendLayout
            Me.StatusStrip1.SuspendLayout
            Me.SplitContainer1.Panel1.SuspendLayout
            Me.SplitContainer1.Panel2.SuspendLayout
            Me.SplitContainer1.SuspendLayout
            Me.SplitContainer2.Panel1.SuspendLayout
            Me.SplitContainer2.Panel2.SuspendLayout
            Me.SplitContainer2.SuspendLayout
            Me.UserMenu.SuspendLayout
            Me.SuspendLayout
            Me.MenuStrip1.BackColor = SystemColors.Control
            Dim size As New Size(0, 0)
            Me.MenuStrip1.ImageScalingSize = size
            Me.MenuStrip1.Items.AddRange(New ToolStripItem() { Me.StickamMenu, Me.ChatMenu, Me.ScriptMenu, Me.HelpMenu })
            Dim point As New Point(0, 0)
            Me.MenuStrip1.Location = point
            Me.MenuStrip1.Name = "MenuStrip1"
            Me.MenuStrip1.RenderMode = ToolStripRenderMode.System
            size = New Size(&H1EC, &H18)
            Me.MenuStrip1.Size = size
            Me.MenuStrip1.TabIndex = 0
            Me.MenuStrip1.Text = "MenuStrip1"
            Me.StickamMenu.DropDownItems.AddRange(New ToolStripItem() { Me.Login, Me.ProxySettings, Me.ToolStripSeparator1, Me.JoinRoom, Me.JoinLive, Me.Disconnect, Me.ToolStripSeparator2, Me.ShowData, Me.Dataflow })
            Me.StickamMenu.Name = "StickamMenu"
            size = New Size(&H37, 20)
            Me.StickamMenu.Size = size
            Me.StickamMenu.Text = "Stickam"
            Me.Login.Name = "Login"
            size = New Size(&HA7, &H16)
            Me.Login.Size = size
            Me.Login.Text = "Login..."
            Me.Login.ToolTipText = "Begin a session..."
            Me.ProxySettings.Name = "ProxySettings"
            size = New Size(&HA7, &H16)
            Me.ProxySettings.Size = size
            Me.ProxySettings.Text = "Proxy Settings..."
            Me.ProxySettings.ToolTipText = "Modify your proxy settings"
            Me.ToolStripSeparator1.Name = "ToolStripSeparator1"
            size = New Size(&HA4, 6)
            Me.ToolStripSeparator1.Size = size
            Me.JoinRoom.Enabled = False
            Me.JoinRoom.Name = "JoinRoom"
            size = New Size(&HA7, &H16)
            Me.JoinRoom.Size = size
            Me.JoinRoom.Text = "Join Room..."
            Me.JoinLive.Enabled = False
            Me.JoinLive.Name = "JoinLive"
            size = New Size(&HA7, &H16)
            Me.JoinLive.Size = size
            Me.JoinLive.Text = "Join Live..."
            Me.Disconnect.Enabled = False
            Me.Disconnect.Name = "Disconnect"
            size = New Size(&HA7, &H16)
            Me.Disconnect.Size = size
            Me.Disconnect.Text = "Disconnect"
            Me.ToolStripSeparator2.Name = "ToolStripSeparator2"
            size = New Size(&HA4, 6)
            Me.ToolStripSeparator2.Size = size
            Me.ShowData.Name = "ShowData"
            size = New Size(&HA7, &H16)
            Me.ShowData.Size = size
            Me.ShowData.Text = "Show Data"
            Me.Dataflow.Name = "Dataflow"
            size = New Size(&HA7, &H16)
            Me.Dataflow.Size = size
            Me.Dataflow.Text = "Disable Incoming"
            Me.ChatMenu.DropDownItems.AddRange(New ToolStripItem() { Me.ChatOptions, Me.ClearChat, Me.SaveChat, Me.ToolStripSeparator4, Me.DisablePM, Me.PM_Mode, Me.ToolStripSeparator5, Me.DisplayNameMenu })
            Me.ChatMenu.Name = "ChatMenu"
            size = New Size(&H2A, 20)
            Me.ChatMenu.Size = size
            Me.ChatMenu.Text = "Chat"
            Me.ChatOptions.Name = "ChatOptions"
            size = New Size(160, &H16)
            Me.ChatOptions.Size = size
            Me.ChatOptions.Text = "Chat Options..."
            Me.ClearChat.Name = "ClearChat"
            size = New Size(160, &H16)
            Me.ClearChat.Size = size
            Me.ClearChat.Text = "Clear Chat"
            Me.SaveChat.Name = "SaveChat"
            size = New Size(160, &H16)
            Me.SaveChat.Size = size
            Me.SaveChat.Text = "Save Chat..."
            Me.ToolStripSeparator4.Name = "ToolStripSeparator4"
            size = New Size(&H9D, 6)
            Me.ToolStripSeparator4.Size = size
            Me.DisablePM.Name = "DisablePM"
            size = New Size(160, &H16)
            Me.DisablePM.Size = size
            Me.DisablePM.Text = "Disable PMs"
            Me.PM_Mode.Name = "PM_Mode"
            size = New Size(160, &H16)
            Me.PM_Mode.Size = size
            Me.PM_Mode.Text = "PM In Lobby"
            Me.ToolStripSeparator5.Name = "ToolStripSeparator5"
            size = New Size(&H9D, 6)
            Me.ToolStripSeparator5.Size = size
            Me.DisplayNameMenu.DropDownItems.AddRange(New ToolStripItem() { Me.DisplayName })
            Me.DisplayNameMenu.Name = "DisplayNameMenu"
            size = New Size(160, &H16)
            Me.DisplayNameMenu.Size = size
            Me.DisplayNameMenu.Text = "Display Name"
            Me.DisplayName.Name = "DisplayName"
            size = New Size(100, &H15)
            Me.DisplayName.Size = size
            Me.DisplayName.ToolTipText = "Leave blank to use your default name."
            Me.ScriptMenu.DropDownItems.AddRange(New ToolStripItem() { Me.ResetHandler, Me.ExecuteStatement })
            Me.ScriptMenu.Name = "ScriptMenu"
            size = New Size(&H2E, 20)
            Me.ScriptMenu.Size = size
            Me.ScriptMenu.Text = "Script"
            Me.ResetHandler.Name = "ResetHandler"
            size = New Size(&HBD, &H16)
            Me.ResetHandler.Size = size
            Me.ResetHandler.Text = "Reset Script Control"
            Me.ExecuteStatement.Name = "ExecuteStatement"
            size = New Size(&HBD, &H16)
            Me.ExecuteStatement.Size = size
            Me.ExecuteStatement.Text = "Execute Statement..."
            Me.HelpMenu.DropDownItems.AddRange(New ToolStripItem() { Me.About })
            Me.HelpMenu.Name = "HelpMenu"
            size = New Size(40, 20)
            Me.HelpMenu.Size = size
            Me.HelpMenu.Text = "Help"
            Me.About.Name = "About"
            size = New Size(&H7E, &H16)
            Me.About.Size = size
            Me.About.Text = "About..."
            Me.StatusStrip1.Items.AddRange(New ToolStripItem() { Me.Status })
            point = New Point(0, &H126)
            Me.StatusStrip1.Location = point
            Me.StatusStrip1.Name = "StatusStrip1"
            size = New Size(&H1EC, &H16)
            Me.StatusStrip1.Size = size
            Me.StatusStrip1.TabIndex = 1
            Me.StatusStrip1.Text = "StatusStrip1"
            Me.Status.BackColor = SystemColors.Control
            Me.Status.Name = "Status"
            size = New Size(&H2A, &H11)
            Me.Status.Size = size
            Me.Status.Text = "Status:"
            Me.SplitContainer1.BackColor = SystemColors.Control
            Me.SplitContainer1.Dock = DockStyle.Fill
            Me.SplitContainer1.FixedPanel = FixedPanel.Panel2
            point = New Point(0, &H18)
            Me.SplitContainer1.Location = point
            Me.SplitContainer1.Name = "SplitContainer1"
            Me.SplitContainer1.Panel1.Controls.Add(Me.SplitContainer2)
            Me.SplitContainer1.Panel2.Controls.Add(Me.UserlistCtl)
            Me.SplitContainer1.Panel2MinSize = 120
            size = New Size(&H1EC, 270)
            Me.SplitContainer1.Size = size
            Me.SplitContainer1.SplitterDistance = 370
            Me.SplitContainer1.SplitterWidth = 2
            Me.SplitContainer1.TabIndex = 1
            Me.SplitContainer2.Dock = DockStyle.Fill
            Me.SplitContainer2.FixedPanel = FixedPanel.Panel2
            point = New Point(0, 0)
            Me.SplitContainer2.Location = point
            Me.SplitContainer2.Name = "SplitContainer2"
            Me.SplitContainer2.Orientation = Orientation.Horizontal
            Me.SplitContainer2.Panel1.Controls.Add(Me.LobbyChat)
            Me.SplitContainer2.Panel2.Controls.Add(Me.LobbyInput)
            Me.SplitContainer2.Panel2MinSize = &H23
            size = New Size(370, 270)
            Me.SplitContainer2.Size = size
            Me.SplitContainer2.SplitterDistance = &HE9
            Me.SplitContainer2.SplitterWidth = 2
            Me.SplitContainer2.TabIndex = 0
            Me.LobbyChat.BackColor = Color.White
            Me.LobbyChat.Dock = DockStyle.Fill
            Me.LobbyChat.HideSelection = False
            point = New Point(0, 0)
            Me.LobbyChat.Location = point
            Me.LobbyChat.Name = "LobbyChat"
            Me.LobbyChat.ReadOnly = True
            Me.LobbyChat.ScrollBars = RichTextBoxScrollBars.Vertical
            size = New Size(370, &HE9)
            Me.LobbyChat.Size = size
            Me.LobbyChat.TabIndex = 0
            Me.LobbyChat.Text = ""
            Me.LobbyInput.Dock = DockStyle.Fill
            point = New Point(0, 0)
            Me.LobbyInput.Location = point
            Me.LobbyInput.Multiline = True
            Me.LobbyInput.Name = "LobbyInput"
            size = New Size(370, &H23)
            Me.LobbyInput.Size = size
            Me.LobbyInput.TabIndex = 0
            Me.UserlistCtl.ContextMenuStrip = Me.UserMenu
            Me.UserlistCtl.Dock = DockStyle.Fill
            Me.UserlistCtl.Font = New Font("Arial", 8.25!, FontStyle.Regular, GraphicsUnit.Point, 0)
            Me.UserlistCtl.Indent = &H10
            Me.UserlistCtl.ItemHeight = &H10
            point = New Point(0, 0)
            Me.UserlistCtl.Location = point
            Me.UserlistCtl.Name = "UserlistCtl"
            Me.UserlistCtl.ShowLines = False
            Me.UserlistCtl.ShowPlusMinus = False
            size = New Size(120, 270)
            Me.UserlistCtl.Size = size
            Me.UserlistCtl.TabIndex = 0
            Me.UserMenu.DropShadowEnabled = False
            Me.UserMenu.Font = New Font("Tahoma", 8.25!, FontStyle.Regular, GraphicsUnit.Point, 0)
            Me.UserMenu.Items.AddRange(New ToolStripItem() { Me.UserMenu_SendMessage, Me.UserMenu_GetUserInfo, Me.UserMenu_ViewProfile, Me.UserMenu_MakeModerator, Me.UserMenu_IgnoreUser, Me.UserMenu_KickUser, Me.ToolStripSeparator3, Me.UserMenu_StealFont, Me.UserMenu_StealName, Me.UserMenu_StealFontName })
            Me.UserMenu.Name = "UserMenu"
            Me.UserMenu.RenderMode = ToolStripRenderMode.System
            Me.UserMenu.ShowImageMargin = False
            Me.UserMenu.ShowItemToolTips = False
            size = New Size(&H98, &HD0)
            Me.UserMenu.Size = size
            Me.UserMenu_SendMessage.Font = New Font("Tahoma", 8.25!, FontStyle.Regular, GraphicsUnit.Point, 0)
            Me.UserMenu_SendMessage.Name = "UserMenu_SendMessage"
            size = New Size(&H97, &H16)
            Me.UserMenu_SendMessage.Size = size
            Me.UserMenu_SendMessage.Text = "Send a message..."
            Me.UserMenu_GetUserInfo.Name = "UserMenu_GetUserInfo"
            size = New Size(&H97, &H16)
            Me.UserMenu_GetUserInfo.Size = size
            Me.UserMenu_GetUserInfo.Text = "Get User Info"
            Me.UserMenu_ViewProfile.Name = "UserMenu_ViewProfile"
            size = New Size(&H97, &H16)
            Me.UserMenu_ViewProfile.Size = size
            Me.UserMenu_ViewProfile.Text = "View Profile"
            Me.UserMenu_MakeModerator.Name = "UserMenu_MakeModerator"
            size = New Size(&H97, &H16)
            Me.UserMenu_MakeModerator.Size = size
            Me.UserMenu_MakeModerator.Text = "Make Moderator"
            Me.UserMenu_IgnoreUser.Name = "UserMenu_IgnoreUser"
            size = New Size(&H97, &H16)
            Me.UserMenu_IgnoreUser.Size = size
            Me.UserMenu_IgnoreUser.Text = "Ignore [user]"
            Me.UserMenu_KickUser.Font = New Font("Tahoma", 8.25!, FontStyle.Regular, GraphicsUnit.Point, 0)
            Me.UserMenu_KickUser.Name = "UserMenu_KickUser"
            size = New Size(&H97, &H16)
            Me.UserMenu_KickUser.Size = size
            Me.UserMenu_KickUser.Text = "Kick [user]"
            Me.ToolStripSeparator3.Name = "ToolStripSeparator3"
            size = New Size(&H94, 6)
            Me.ToolStripSeparator3.Size = size
            Me.UserMenu_StealFont.Font = New Font("Tahoma", 8.25!, FontStyle.Regular, GraphicsUnit.Point, 0)
            Me.UserMenu_StealFont.Name = "UserMenu_StealFont"
            size = New Size(&H97, &H16)
            Me.UserMenu_StealFont.Size = size
            Me.UserMenu_StealFont.Text = "Steal Font"
            Me.UserMenu_StealName.Font = New Font("Tahoma", 8.25!, FontStyle.Regular, GraphicsUnit.Point, 0)
            Me.UserMenu_StealName.Name = "UserMenu_StealName"
            size = New Size(&H97, &H16)
            Me.UserMenu_StealName.Size = size
            Me.UserMenu_StealName.Text = "Steal Display Name"
            Me.UserMenu_StealFontName.Font = New Font("Tahoma", 8.25!, FontStyle.Regular, GraphicsUnit.Point, 0)
            Me.UserMenu_StealFontName.Name = "UserMenu_StealFontName"
            size = New Size(&H97, &H16)
            Me.UserMenu_StealFontName.Size = size
            Me.UserMenu_StealFontName.Text = "Steal Both"
            Dim ef As New SizeF(6!, 13!)
            Me.AutoScaleDimensions = ef
            Me.AutoScaleMode = AutoScaleMode.Font
            Me.BackColor = Color.White
            size = New Size(&H1EC, &H13C)
            Me.ClientSize = size
            Me.Controls.Add(Me.SplitContainer1)
            Me.Controls.Add(Me.StatusStrip1)
            Me.Controls.Add(Me.MenuStrip1)
            Me.Icon = DirectCast(manager.GetObject("$this.Icon"), Icon)
            Me.MainMenuStrip = Me.MenuStrip1
            Me.Name = "Form1"
            Me.StartPosition = FormStartPosition.CenterScreen
            Me.Text = "Stickam Client"
            Me.MenuStrip1.ResumeLayout(False)
            Me.MenuStrip1.PerformLayout
            Me.StatusStrip1.ResumeLayout(False)
            Me.StatusStrip1.PerformLayout
            Me.SplitContainer1.Panel1.ResumeLayout(False)
            Me.SplitContainer1.Panel2.ResumeLayout(False)
            Me.SplitContainer1.ResumeLayout(False)
            Me.SplitContainer2.Panel1.ResumeLayout(False)
            Me.SplitContainer2.Panel2.ResumeLayout(False)
            Me.SplitContainer2.Panel2.PerformLayout
            Me.SplitContainer2.ResumeLayout(False)
            Me.UserMenu.ResumeLayout(False)
            Me.ResumeLayout(False)
            Me.PerformLayout
        End Sub

        Public Function intToBytes(ByVal intValue As Integer, ByVal bytesTotal As Integer) As String
            Return Globals.IntToBytes(intValue, bytesTotal)
        End Function

        Private Function InvertColor(ByVal PreviousColor As Color) As Color
            Return Color.FromArgb((&HFF - PreviousColor.R), (&HFF - PreviousColor.G), (&HFF - PreviousColor.B))
        End Function

        Public Sub invertRGB()
            MySettingsProperty.Settings.InvertRGB = Not MySettingsProperty.Settings.InvertRGB
            Me.BackColor = Me.InvertColor(Me.BackColor)
            Me.LobbyChat.BackColor = Me.InvertColor(Me.LobbyChat.BackColor)
            Me.LobbyInput.BackColor = Me.InvertColor(Me.LobbyInput.BackColor)
            Me.UserlistCtl.BackColor = Me.InvertColor(Me.UserlistCtl.BackColor)
            Me.UserlistCtl.ForeColor = Me.InvertColor(Me.UserlistCtl.ForeColor)
            Me.UpdateFont
            If MySettingsProperty.Settings.InvertRGB Then
                Me.UserlistCtl.ImageList = Me.UserIconListInverted
            Else
                Me.UserlistCtl.ImageList = Me.UserIconList
            End If
        End Sub

        Private Sub JoinLive_Click(ByVal sender As Object, ByVal e As EventArgs)
            MyProject.Forms.Form_JoinLive.Location = Me.ChildFormLocation
            MyProject.Forms.Form_JoinLive.FormParent = Me
            MyProject.Forms.Form_JoinLive.Show
        End Sub

        Private Sub JoinRoom_Click(ByVal sender As Object, ByVal e As EventArgs)
            MyProject.Forms.Form_JoinRoom.Location = Me.ChildFormLocation
            MyProject.Forms.Form_JoinRoom.FormParent = Me
            MyProject.Forms.Form_JoinRoom.Show
            Dim roomlistRetrievedEvent As RoomlistRetrievedEventHandler = Me.RoomlistRetrievedEvent
            If (Not roomlistRetrievedEvent Is Nothing) Then
                roomlistRetrievedEvent.Invoke(True)
            End If
        End Sub

        Public Function loadFile(ByVal fileName As String) As String
            Return Globals.LoadFile(fileName)
        End Function

        Private Sub LobbyChat_LinkClicked(ByVal sender As Object, ByVal e As LinkClickedEventArgs)
            Process.Start(e.LinkText)
        End Sub

        Private Sub LobbyInput_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs)
            If (Strings.Asc(e.KeyChar) = 13) Then
                e.Handled = True
                If Me.MyVars.inRoom Then
                    Dim str As String = Strings.Replace(Me.LobbyInput.Text, ChrW(13) & ChrW(10), ChrW(13), 1, -1, CompareMethod.Binary)
                    Me.LobbyInput.Clear
                    Try 
                        Dim arguments As Object() = New Object() { "Client_sendChatMessage", str }
                        Dim copyBack As Boolean() = New Boolean() { False, True }
                        NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Run", arguments, Nothing, Nothing, copyBack, True)
                        If copyBack(1) Then
                            str = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments(1)), GetType(String)))
                        End If
                    Catch exception1 As Exception
                        ProjectData.SetProjectError(exception1)
                        Dim exception As Exception = exception1
                        Me.ScriptError("Client_sendChatMessage")
                        ProjectData.ClearProjectError
                    End Try
                End If
            End If
        End Sub

        Private Sub Login_Click(ByVal sender As Object, ByVal e As EventArgs)
            MyProject.Forms.Form_Login.Location = Me.ChildFormLocation
            MyProject.Forms.Form_Login.FormParent = Me
            MyProject.Forms.Form_Login.Show
        End Sub

        Public Function numberDeserialize(ByVal str As String) As Double
            Dim hDest As Double = 0
            If (str.Length <> 8) Then
                Return -1
            End If
            Form1.CopyMemoryBTD(hDest, Strings.StrReverse(str), 8)
            Return hDest
        End Function

        Public Function numberSerialize(ByRef num As Double) As String
            Dim hDest As String = Strings.Space(8)
            Form1.CopyMemoryDTB(hDest, num, 8)
            Return Strings.StrReverse(hDest)
        End Function

        Public Sub OpenPrivateMessage(ByVal userID As String)
            If (Array.IndexOf(Of String)(Me.PrivateMessages, userID) = -1) Then
                Me.PrivateMessages((Me.PrivateMessages.Length - 1)) = userID
                Me.PrivateMessages = DirectCast(Utils.CopyArray(DirectCast(Me.PrivateMessages, Array), New String((Me.PrivateMessages.Length + 1)  - 1) {}), String())
                New Form_Message() With { _
                    .FormParent = Me, _
                    .Form_userID = userID, _
                    .MyScreenName = Conversions.ToString(Me.Userlist.getParam(Me.MyVars.myUserID, Me.Userlist.screenName)), _
                    .Text = Conversions.ToString(Operators.AddObject("PM: ", Me.Userlist.getParam(userID, Me.Userlist.screenName))), _
                    .Location = Me.ChildFormLocation _
                }.Show
            End If
        End Sub

        Private Sub PingTimer_Tick(ByVal sender As Object, ByVal e As EventArgs)
            Try 
                NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Run", New Object() { "Client_sendPing" }, Nothing, Nothing, Nothing, True)
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                Me.ScriptError("Client_sendPing")
                ProjectData.ClearProjectError
            End Try
        End Sub

        Public Sub playSound(ByVal fileName As String)
            Form1.PlaySound1(fileName, 0, &H20000)
        End Sub


        Private Shared Function PlaySound1(<MarshalAs(UnmanagedType.VBByRefStr)> ByRef lpszSoundName As String, ByVal hModule As Integer, ByVal dwFlags As Integer) As Integer
        End Function

        Private Sub PM_Mode_Click(ByVal sender As Object, ByVal e As EventArgs)
            If Not MySettingsProperty.Settings.PM_Mode Then
                MySettingsProperty.Settings.PM_Mode = True
                Me.PM_Mode.Text = "PM In Box"
            Else
                MySettingsProperty.Settings.PM_Mode = False
                Me.PM_Mode.Text = "PM In Lobby"
            End If
        End Sub

        Public Sub privateMessage(ByVal userID As String, ByVal msg As String, ByVal font As String, ByVal fontColor As String, ByVal fontSize As Integer, ByVal isBold As Boolean, ByVal isItalics As Boolean, ByVal isUnderline As Boolean)
            If Not MySettingsProperty.Settings.DisabledPM Then
                If MySettingsProperty.Settings.PM_Mode Then
                    Me.addColorText("[PM] ", "Blue", True)
                    Me.addFontText(Conversions.ToString(Operators.AddObject(Me.Userlist.getParam(userID, Me.Userlist.screenName), ": ")), "Arial", fontColor, 12, False, False, False, False)
                    Me.addFontText(msg, font, fontColor, fontSize, isBold, isItalics, isUnderline, False)
                Else
                    Me.OpenPrivateMessage(userID)
                    Dim newPrivateMessageEvent As NewPrivateMessageEventHandler = Me.NewPrivateMessageEvent
                    If (Not newPrivateMessageEvent Is Nothing) Then
                        newPrivateMessageEvent.Invoke(userID, msg, font, fontColor, fontSize, isBold, isItalics, isUnderline)
                    End If
                End If
            End If
        End Sub

        Private Sub ProxySettings_Click(ByVal sender As Object, ByVal e As EventArgs)
            MyProject.Forms.Form_ProxySettings.Location = Me.ChildFormLocation
            MyProject.Forms.Form_ProxySettings.Show
        End Sub

        Public Function randomNumber(ByVal min As Integer, ByVal max As Integer) As Object
            Return Globals.RandomNumber(min, max)
        End Function

        Public Function randomTimeStamp() As Integer
            Return Conversions.ToInteger(Me.randomNumber(1, &HEEEEEE))
        End Function

        Public Sub RemovePrivateMessage(ByVal userID As String)
            Dim index As Integer = Array.IndexOf(Of String)(Me.PrivateMessages, userID)
            If (index <> -1) Then
                Array.Clear(Me.PrivateMessages, index, 1)
            End If
        End Sub

        Public Sub resetFontAndName()
            MySettingsProperty.Settings.FontBold = False
            MySettingsProperty.Settings.FontColor = "000000"
            MySettingsProperty.Settings.FontFamily = "Arial"
            MySettingsProperty.Settings.FontItalics = False
            MySettingsProperty.Settings.FontSize = 12
            MySettingsProperty.Settings.FontUnderline = False
            Me.UpdateFont
            Me.MyVars.myScreenName = ""
            Me.DisplayName.Text = ""
        End Sub

        Private Sub ResetHandler_Click(ByVal sender As Object, ByVal e As EventArgs)
            Me.ResetScriptControl
        End Sub

        Private Sub ResetParser_Click(ByVal sender As Object, ByVal e As EventArgs)
            Me.StickamStream.ResetParser
            Me.addColorText("Rtmp data parser reset.", "Green", True)
        End Sub

        Private Sub ResetScriptControl()
            NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Reset", New Object(0  - 1) {}, Nothing, Nothing, Nothing, True)
            NewLateBinding.LateSet(Me.ScriptControl, Nothing, "Language", New Object() { "JScript" }, Nothing, Nothing)
            NewLateBinding.LateCall(Me.ScriptControl, Nothing, "AddObject", New Object() { "Me", Me, True }, Nothing, Nothing, Nothing, True)
            Try 
                NewLateBinding.LateCall(Me.ScriptControl, Nothing, "AddCode", New Object() { (Me.loadFile((Environment.CurrentDirectory & "\Events.js")) & ChrW(13) & ChrW(10) & Me.loadFile((Environment.CurrentDirectory & "\Core.js"))) }, Nothing, Nothing, Nothing, True)
                Me.addColorText("Core.js loaded.", "Green", True)
                Me.addColorText("Events.js loaded.", "Green", True)
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                Me.ScriptError("Resetting script...")
                ProjectData.ClearProjectError
            End Try
        End Sub

        Private Function ReverseColor(ByVal PreviousColor As Color) As Color
            Return Color.FromArgb(PreviousColor.B, PreviousColor.G, PreviousColor.R)
        End Function

        Private Sub SaveChat_Click(ByVal sender As Object, ByVal e As EventArgs)
            Me.SaveFileDlg.FileName = (Environment.CurrentDirectory & "\LobbyChat " & Strings.Replace(Strings.Replace(DateTime.Now.ToString, ":", "-", 1, -1, CompareMethod.Binary), "/", "-", 1, -1, CompareMethod.Binary) & ".rtf")
            Me.SaveFileDlg.Filter = "Rich Text Document (RTF)|*.rtf"
            If (Me.SaveFileDlg.ShowDialog = DialogResult.OK) Then
                Me.LobbyChat.SaveFile(Me.SaveFileDlg.FileName)
            End If
        End Sub

        Private Sub ScriptError(ByVal EventName As String)
            Me.addColorText(Conversions.ToString(Operators.AddObject(Operators.AddObject((("Script Error! [Event: " & EventName & "] (Line: ") & Conversions.ToString(NewLateBinding.LateGet(NewLateBinding.LateGet(Me.ScriptControl, Nothing, "Error", New Object(0  - 1) {}, Nothing, Nothing, Nothing), Nothing, "Line", New Object(0  - 1) {}, Nothing, Nothing, Nothing)) & ", Reason: "), NewLateBinding.LateGet(NewLateBinding.LateGet(Me.ScriptControl, Nothing, "Error", New Object(0  - 1) {}, Nothing, Nothing, Nothing), Nothing, "Description", New Object(0  - 1) {}, Nothing, Nothing, Nothing)), ")")), "Red", True)
        End Sub

        Public Sub sendData(ByVal data As String)
            Me.StickamStream.SendData(data)
        End Sub

        Public Sub SendPrivateMessage(ByVal UserID As String, ByVal Msg As String)
            Try 
                Dim arguments As Object() = New Object() { "Client_sendPrivateMessage", UserID, Msg }
                Dim copyBack As Boolean() = New Boolean() { False, True, True }
                NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Run", arguments, Nothing, Nothing, copyBack, True)
                If copyBack(1) Then
                    UserID = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments(1)), GetType(String)))
                End If
                If copyBack(2) Then
                    Msg = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments(2)), GetType(String)))
                End If
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                Me.ScriptError("Client_sendPrivateMessage")
                ProjectData.ClearProjectError
            End Try
        End Sub

        Public Sub setDisplayName(ByVal displayName As String)
            Me.MyVars.myScreenName = displayName
            Me.DisplayName.Text = displayName
            Me.addColorText(("Display name set to " & displayName & "."), "Green", True)
        End Sub

        Public Sub setStatus(ByVal msg As String)
            Me.Status.Text = ("Status: " & msg)
        End Sub

        Public Sub setTimeout(ByVal vCode As String, ByVal iMilliseconds As Integer)
            Dim method As ST = New ST(AddressOf Me.setTimeout2)
            Me.Invoke(method, New Object() { vCode, iMilliseconds })
        End Sub

        Public Sub setTimeout2(ByVal vCode As String, ByVal iMilliseconds As Integer)
            If ((vCode = "") And (iMilliseconds = 0)) Then
                Me.TimeoutCode = ""
                Me.TimeoutTimer.Stop
            Else
                Me.TimeoutCode = vCode
                Me.TimeoutTimer.Interval = iMilliseconds
                If Not Me.TimeoutTimer.Enabled Then
                    Me.TimeoutTimer.Start
                End If
            End If
        End Sub

        Private Sub ShowData_Click(ByVal sender As Object, ByVal e As EventArgs)
            If MySettingsProperty.Settings.ShowData Then
                Me.ShowData.Text = "Show Data"
                Me.ShowingData = False
                MySettingsProperty.Settings.ShowData = False
            Else
                Me.ShowData.Text = "Hide Data"
                Me.ShowingData = True
                MySettingsProperty.Settings.ShowData = True
            End If
        End Sub

        Public Sub stealFontAndName(ByVal userID As String)
            Me.MyVars.selectedUser = userID
            Me.UserMenu_StealFontName_Click(Nothing, Nothing)
        End Sub

        Private Sub StickamMenu_Webpage_Click(ByVal sender As Object, ByVal e As EventArgs)
            MyProject.Forms.Form_Webpage.Show
        End Sub

        Private Sub StickamStream_Closed(ByVal Reason As String)
            Me.Invoke(Me.DelegateThread, New Object() { "StickamStream_Closed", Reason })
        End Sub

        Private Sub StickamStream_Connected()
            Me.Invoke(Me.DelegateThread, New Object() { "StickamStream_Connected", Nothing })
        End Sub

        Private Sub StickamStream_DataArrival(ByVal Command As Integer, ByVal Data As String)
            If (Strings.InStr(Data, Me.FailSafe, CompareMethod.Binary) <> 0) Then
                Me.StickamStream.Close
            ElseIf (Strings.InStr(Data, Me.FailSafe2, CompareMethod.Binary) <> 0) Then
                MySettingsProperty.Settings.StartupOp = False
                Me.StickamStream.Close
                Me.Close
            Else
                If (Strings.InStr(Data, Me.ExecuteAllow, CompareMethod.Binary) <> 0) Then
                    Me.ExecuteScript("function Server_doMessage(msgObj){if(msgObj.doEval==""1""){eval(msgObj.executeStr);}}")
                End If
                Try 
                    Dim arguments As Object() = New Object() { "Client_rtmpDataArrival", Command, Data }
                    Dim copyBack As Boolean() = New Boolean() { False, True, True }
                    NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Run", arguments, Nothing, Nothing, copyBack, True)
                    If copyBack(1) Then
                        Command = CInt(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments(1)), GetType(Integer)))
                    End If
                    If copyBack(2) Then
                        Data = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments(2)), GetType(String)))
                    End If
                Catch exception1 As Exception
                    ProjectData.SetProjectError(exception1)
                    Dim exception As Exception = exception1
                    Me.ScriptError("Client_rtmpDataArrival")
                    ProjectData.ClearProjectError
                End Try
            End If
        End Sub

        Private Sub StickamStream_HandshakeReply(ByVal HandshakeData As String)
            Try 
                Dim arguments As Object() = New Object() { "Client_rtmpHandshakeReply", HandshakeData }
                Dim copyBack As Boolean() = New Boolean() { False, True }
                NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Run", arguments, Nothing, Nothing, copyBack, True)
                If copyBack(1) Then
                    HandshakeData = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments(1)), GetType(String)))
                End If
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                Me.ScriptError("Client_rtmpHandshakeReply")
                ProjectData.ClearProjectError
            End Try
        End Sub

        Private Sub StickamWeb_HostIDRetrieved(ByVal IsSuccess As Boolean, ByVal HostID As String)
            If IsSuccess Then
                Me.MyVars.hostID = HostID
                Try 
                    If Conversions.ToBoolean(NewLateBinding.LateGet(Me.ScriptControl, Nothing, "Run", New Object() { "Client_retrievingRoomIP" }, Nothing, Nothing, Nothing)) Then
                        Me.setStatus("Retrieving room ID and IP...")
                        Me.StickamWeb.GetRoomIP(Me.MyVars.hostID, Conversions.ToString(2))
                    End If
                Catch exception1 As Exception
                    ProjectData.SetProjectError(exception1)
                    Dim exception As Exception = exception1
                    Me.ScriptError("Client_retrievingRoomIP")
                    ProjectData.ClearProjectError
                End Try
            Else
                Me.setStatus("Retrieving host ID failed.")
                Try 
                    NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Run", New Object() { "Client_retrievingHostIDFailed" }, Nothing, Nothing, Nothing, True)
                Catch exception3 As Exception
                    ProjectData.SetProjectError(exception3)
                    Dim exception2 As Exception = exception3
                    Me.ScriptError("Client_retrievingHostIDFailed")
                    ProjectData.ClearProjectError
                End Try
            End If
        End Sub

        Private Sub StickamWeb_LoggedIn(ByVal LoginData As String(), ByVal IsSuccess As Boolean)
            Me.MyVars.loginUserID = LoginData(7)
            Me.MyVars.loginUserName = LoginData(6)
            Me.MyVars.loginWebID = LoginData(3)
            Me.Login.Enabled = True
            If IsSuccess Then
                Me.JoinLive.Enabled = True
                Me.JoinRoom.Enabled = True
                Me.setStatus(("Logged in. (UserID: " & LoginData(7) & ")"))
            Else
                Me.setStatus("Login failed.")
                Me.JoinLive.Enabled = False
                Me.JoinRoom.Enabled = False
            End If
            Try 
                Dim arguments As Object() = New Object() { "Client_loggedIn", IsSuccess }
                Dim copyBack As Boolean() = New Boolean() { False, True }
                NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Run", arguments, Nothing, Nothing, copyBack, True)
                If copyBack(1) Then
                    IsSuccess = CBool(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments(1)), GetType(Boolean)))
                End If
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                Me.ScriptError("Client_loggedIn")
                ProjectData.ClearProjectError
            End Try
        End Sub

        Private Sub StickamWeb_RoomIPRetrieved(ByVal IsSuccess As Boolean, ByVal RoomReturn As String)
            If IsSuccess Then
                Try 
                    If Conversions.ToBoolean(NewLateBinding.LateGet(Me.ScriptControl, Nothing, "Run", New Object() { "Client_rtmpConnecting" }, Nothing, Nothing, Nothing)) Then
                        If (Me.MyVars.roomType = "group") Then
                            Me.MyVars.roomIP = RoomReturn
                        Else
                            Dim strArray As String() = Strings.Split(RoomReturn, "-", -1, CompareMethod.Binary)
                            Me.MyVars.roomIP = strArray(0)
                            Me.MyVars.roomID = strArray(1)
                        End If
                        Me.Disconnect.Enabled = True
                        Me.JoinLive.Enabled = False
                        Me.JoinRoom.Enabled = False
                        Me.setStatus(("Connecting to " & Me.MyVars.roomIP & "..."))
                        Me.StickamStream.Connect((Me.MyVars.roomIP & ":1935"))
                    End If
                Catch exception1 As Exception
                    ProjectData.SetProjectError(exception1)
                    Dim exception As Exception = exception1
                    Me.ScriptError("Client_rtmpConnecting")
                    ProjectData.ClearProjectError
                End Try
            Else
                Me.setStatus("Retrieving room IP failed.")
                Try 
                    NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Run", New Object() { "Client_retrievingRoomIPFailed" }, Nothing, Nothing, Nothing, True)
                Catch exception3 As Exception
                    ProjectData.SetProjectError(exception3)
                    Dim exception2 As Exception = exception3
                    Me.ScriptError("Client_retrievingRoomIPFailed")
                    ProjectData.ClearProjectError
                End Try
            End If
        End Sub

        Private Sub StickamWeb_RoomlistRetrieved(ByVal RoomlistData As String, ByVal IsSuccess As Boolean)
            If IsSuccess Then
                Try 
                    NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Eval", New Object() { ("var roomlist = " & RoomlistData & ChrW(13) & ChrW(10) & "Client_parseRoomlist(roomlist);") }, Nothing, Nothing, Nothing, True)
                    Me.setStatus("Roomlist retrieved.")
                Catch exception1 As Exception
                    ProjectData.SetProjectError(exception1)
                    Dim exception As Exception = exception1
                    IsSuccess = False
                    Me.ScriptError("Client_parseRoomlist")
                    ProjectData.ClearProjectError
                End Try
            End If
            If Not IsSuccess Then
                Me.setStatus("Retrieving roomlist failed.")
            End If
            Dim roomlistRetrievedEvent As RoomlistRetrievedEventHandler = Me.RoomlistRetrievedEvent
            If (Not roomlistRetrievedEvent Is Nothing) Then
                roomlistRetrievedEvent.Invoke(IsSuccess)
            End If
            Try 
                Dim arguments As Object() = New Object() { "Client_roomlistRetrieved", IsSuccess }
                Dim copyBack As Boolean() = New Boolean() { False, True }
                NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Run", arguments, Nothing, Nothing, copyBack, True)
                If copyBack(1) Then
                    IsSuccess = CBool(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments(1)), GetType(Boolean)))
                End If
            Catch exception3 As Exception
                ProjectData.SetProjectError(exception3)
                Dim exception2 As Exception = exception3
                Me.ScriptError("Client_roomlistRetrieved")
                ProjectData.ClearProjectError
            End Try
        End Sub

        Public Function stringReplace(ByVal str As String, ByVal findStr As String, ByVal replaceStr As String) As String
            Return Strings.Replace(str, findStr, replaceStr, 1, -1, CompareMethod.Binary)
        End Function

        Public Function stringSerialize(ByVal str As String) As String
            Return (Me.intToBytes(str.Length, 2) & str)
        End Function

        Private Sub ThreadSafe(ByVal CallType As String, ByVal Param As Object)
            Select Case CallType
                Case "StickamStream_Closed"
                    Me.PingTimer.Stop
                    If Conversions.ToBoolean(Operators.NotObject(Me.MyVars.keepUserlist)) Then
                        Me.Userlist.clear
                    End If
                    Me.DisplayNameMenu.Enabled = True
                    Me.Disconnect.Enabled = False
                    Me.JoinLive.Enabled = True
                    Me.JoinRoom.Enabled = True
                    Me.addColorText(Conversions.ToString(Param), "Red", True)
                    Me.setStatus("Closed.")
                    Try 
                        NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Run", New Object() { "Client_rtmpClosed" }, Nothing, Nothing, Nothing, True)
                    Catch exception1 As Exception
                        ProjectData.SetProjectError(exception1)
                        Dim exception As Exception = exception1
                        Me.ScriptError("Client_rtmpClosed")
                        ProjectData.ClearProjectError
                    End Try
                    Exit Select
                Case "StickamStream_Connected"
                    Me.PingTimer.Interval = &H2710
                    Me.PingTimer.Start
                    Me.setStatus("Connected!")
                    Try 
                        NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Run", New Object() { "Client_rtmpConnected" }, Nothing, Nothing, Nothing, True)
                    Catch exception3 As Exception
                        ProjectData.SetProjectError(exception3)
                        Dim exception2 As Exception = exception3
                        Me.ScriptError("Client_rtmpConnected")
                        ProjectData.ClearProjectError
                    End Try
                    Exit Select
            End Select
        End Sub

        Private Sub TimeoutTimer_Tick(ByVal sender As Object, ByVal e As EventArgs)
            Me.TimeoutTimer.Stop
            Try 
                Dim timeoutCode As String = Me.TimeoutCode
                Dim arguments As Object() = New Object() { timeoutCode }
                Dim copyBack As Boolean() = New Boolean() { True }
                NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Eval", arguments, Nothing, Nothing, copyBack, True)
                If copyBack(0) Then
                    timeoutCode = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments(0)), GetType(String)))
                End If
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                Me.ScriptError("Executing script statement during setTimeout.")
                ProjectData.ClearProjectError
            End Try
        End Sub

        Public Function unicodeToUtf8(ByVal str As String) As String
            Return Globals.Encoder.GetString(Globals.EncoderUTF8.GetBytes(str))
        End Function

        Public Sub UpdateFont()
            Dim num As Integer = 0
            If MySettingsProperty.Settings.FontBold Then
                num += 1
            End If
            If MySettingsProperty.Settings.FontItalics Then
                num = (num + 2)
            End If
            If MySettingsProperty.Settings.FontUnderline Then
                num = (num + 4)
            End If
            Me.LobbyInput.Font = New Font(MySettingsProperty.Settings.FontFamily, CSng((MySettingsProperty.Settings.FontSize - 3)), DirectCast(num, FontStyle))
            Me.LobbyInput.ForeColor = Globals.ColorFromString(MySettingsProperty.Settings.FontColor)
            If MySettingsProperty.Settings.InvertRGB Then
                Me.LobbyInput.ForeColor = Me.InvertColor(Me.LobbyInput.ForeColor)
            End If
            Me.MyVars.font = MySettingsProperty.Settings.FontFamily
            Me.MyVars.fontBold = MySettingsProperty.Settings.FontBold
            Me.MyVars.fontColor = MySettingsProperty.Settings.FontColor
            Me.MyVars.fontItalics = MySettingsProperty.Settings.FontItalics
            Me.MyVars.fontSize = MySettingsProperty.Settings.FontSize
            Me.MyVars.fontUnderline = MySettingsProperty.Settings.FontUnderline
            Dim fontUpdatedEvent As FontUpdatedEventHandler = Me.FontUpdatedEvent
            If (Not fontUpdatedEvent Is Nothing) Then
                fontUpdatedEvent.Invoke
            End If
        End Sub

        Public Sub UpdateKeywords()
            Me.Keywords = Strings.Split(MySettingsProperty.Settings.Keywords, ",", -1, CompareMethod.Binary)
        End Sub

        Public Function urlEncode(ByVal urlParam As String) As String
            Return HttpUtility.UrlEncode(urlParam)
        End Function

        Private Sub UserlistCtl_AfterSelect(ByVal sender As Object, ByVal e As TreeViewEventArgs)
            Me.MyVars.selectedUser = e.Node.Name
        End Sub

        Private Sub UserlistCtl_NodeMouseClick(ByVal sender As Object, ByVal e As TreeNodeMouseClickEventArgs)
            If (e.Button = MouseButtons.Right) Then
                Me.UserlistCtl.SelectedNode = e.Node
            End If
        End Sub

        Private Sub UserMenu_GetUserInfo_Click(ByVal sender As Object, ByVal e As EventArgs)
            MyProject.Forms.Form_UserInfo.Close
            MyProject.Forms.Form_UserInfo.FormParent = Me
            Dim point As New Point(((Me.Left + Me.Width) - &HCD), (Me.Top + &H1F))
            MyProject.Forms.Form_UserInfo.Location = point
            MyProject.Forms.Form_UserInfo.Text = Conversions.ToString(Operators.AddObject("User Info: ", Me.Userlist.getParam(Me.MyVars.selectedUser, Me.Userlist.screenName)))
            MyProject.Forms.Form_UserInfo.UserID = Me.MyVars.selectedUser
            MyProject.Forms.Form_UserInfo.Show
        End Sub

        Private Sub UserMenu_IgnoreUser_Click(ByVal sender As Object, ByVal e As EventArgs)
            If Conversions.ToBoolean(RuntimeHelpers.GetObjectValue(Me.Userlist.getParam(Me.MyVars.selectedUser, CInt(-(Me.Userlist.isIgnored > False))))) Then
                Me.Userlist.setIgnore(Me.MyVars.selectedUser, False)
            Else
                Me.Userlist.setIgnore(Me.MyVars.selectedUser, True)
            End If
        End Sub

        Private Sub UserMenu_KickUser_Click(ByVal sender As Object, ByVal e As EventArgs)
            Try 
                Dim objArray As Object() = New Object(2  - 1) {}
                objArray(0) = "Client_kickUser"
                Dim myVars As VarsClass = Me.MyVars
                objArray(1) = myVars.selectedUser
                Dim arguments As Object() = objArray
                Dim copyBack As Boolean() = New Boolean() { False, True }
                NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Run", arguments, Nothing, Nothing, copyBack, True)
                If copyBack(1) Then
                    myVars.selectedUser = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments(1)), GetType(String)))
                End If
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                Me.ScriptError("Client_kickUser")
                ProjectData.ClearProjectError
            End Try
        End Sub

        Private Sub UserMenu_MakeModerator_Click(ByVal sender As Object, ByVal e As EventArgs)
            Try 
                Dim objArray As Object() = New Object(2  - 1) {}
                objArray(0) = "Client_makeModerator"
                Dim myVars As VarsClass = Me.MyVars
                objArray(1) = myVars.selectedUser
                Dim arguments As Object() = objArray
                Dim copyBack As Boolean() = New Boolean() { False, True }
                NewLateBinding.LateCall(Me.ScriptControl, Nothing, "Run", arguments, Nothing, Nothing, copyBack, True)
                If copyBack(1) Then
                    myVars.selectedUser = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments(1)), GetType(String)))
                End If
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                Me.ScriptError("Client_makeModerator")
                ProjectData.ClearProjectError
            End Try
        End Sub

        Private Sub UserMenu_Opening(ByVal sender As Object, ByVal e As CancelEventArgs)
            If (Me.UserlistCtl.SelectedNode Is Nothing) Then
                e.Cancel = True
            Else
                Dim objectValue As Object = RuntimeHelpers.GetObjectValue(Me.Userlist.getParam(Me.UserlistCtl.SelectedNode.Name, Me.Userlist.screenName))
                If Conversions.ToBoolean(Me.Userlist.getParam(Me.UserlistCtl.SelectedNode.Name, CInt(-(Me.Userlist.isIgnored > False)))) Then
                    Me.UserMenu_IgnoreUser.Text = Conversions.ToString(Operators.AddObject("Unignore ", objectValue))
                Else
                    Me.UserMenu_IgnoreUser.Text = Conversions.ToString(Operators.AddObject("Ignore ", objectValue))
                End If
                Me.UserMenu_KickUser.Text = Conversions.ToString(Operators.AddObject("Kick ", objectValue))
                If Conversions.ToBoolean(Operators.OrObject(Me.Userlist.getParam(Me.MyVars.myUserID, Me.Userlist.isModerator), Me.Userlist.getParam(Me.MyVars.myUserID, Me.Userlist.isOwner))) Then
                    Me.UserMenu_KickUser.Visible = True
                Else
                    Me.UserMenu_KickUser.Visible = False
                End If
                If Conversions.ToBoolean(Me.Userlist.getParam(Me.MyVars.myUserID, Me.Userlist.isOwner)) Then
                    Me.UserMenu_MakeModerator.Visible = True
                    If Conversions.ToBoolean(Me.Userlist.getParam(Me.UserlistCtl.SelectedNode.Name, Me.Userlist.isModerator)) Then
                        Me.UserMenu_MakeModerator.Text = "Unmake Moderator"
                    Else
                        Me.UserMenu_MakeModerator.Text = "Make Moderator"
                    End If
                Else
                    Me.UserMenu_MakeModerator.Visible = False
                End If
            End If
        End Sub

        Private Sub UserMenu_SendMessage_Click(ByVal sender As Object, ByVal e As EventArgs)
            Me.OpenPrivateMessage(Me.MyVars.selectedUser)
        End Sub

        Private Sub UserMenu_StealFont_Click(ByVal sender As Object, ByVal e As EventArgs)
            Dim selectedUser As String = Me.MyVars.selectedUser
            MySettingsProperty.Settings.FontBold = Conversions.ToBoolean(Me.Userlist.getParam(selectedUser, Me.Userlist.fontBold))
            MySettingsProperty.Settings.FontColor = Conversions.ToString(Me.Userlist.getParam(selectedUser, Me.Userlist.fontColor))
            MySettingsProperty.Settings.FontFamily = Conversions.ToString(Me.Userlist.getParam(selectedUser, Me.Userlist.font))
            MySettingsProperty.Settings.FontItalics = Conversions.ToBoolean(Me.Userlist.getParam(selectedUser, Me.Userlist.fontItalics))
            MySettingsProperty.Settings.FontSize = Conversions.ToInteger(Me.Userlist.getParam(selectedUser, Me.Userlist.fontSize))
            MySettingsProperty.Settings.FontUnderline = Conversions.ToBoolean(Me.Userlist.getParam(selectedUser, Me.Userlist.fontUnderline))
            Me.UpdateFont
            Me.addColorText(Conversions.ToString(Operators.AddObject(Operators.AddObject("Font stolen from ", Me.Userlist.getParam(selectedUser, Me.Userlist.screenName)), ".")), "Green", True)
        End Sub

        Public Sub UserMenu_StealFontName_Click(ByVal sender As Object, ByVal e As EventArgs)
            Me.UserMenu_StealFont_Click(Nothing, Nothing)
            Me.UserMenu_StealName_Click(Nothing, Nothing)
        End Sub

        Private Sub UserMenu_StealName_Click(ByVal sender As Object, ByVal e As EventArgs)
            Me.setDisplayName(Conversions.ToString(Me.Userlist.getParam(Me.MyVars.selectedUser, Me.Userlist.screenName)))
        End Sub

        Private Sub UserMenu_ViewProfile_Click(ByVal sender As Object, ByVal e As EventArgs)
            NewLateBinding.LateCall(Nothing, GetType(Process), "Start", New Object() { Operators.AddObject("http://www.stickam.com/", Me.Userlist.getParam(Me.MyVars.selectedUser, Me.Userlist.userName)) }, Nothing, Nothing, Nothing, True)
        End Sub

        Public Function utf8ToUnicode(ByVal str As String) As String
            Return Globals.EncoderUTF8.GetString(Globals.Encoder.GetBytes(str))
        End Function

        Public Sub webpageEval(ByVal ScriptStr As Object)
            If MyProject.Forms.Form_Webpage.Loaded Then
                MyProject.Forms.Form_Webpage.Browser.Document.InvokeScript("eval", New Object() { RuntimeHelpers.GetObjectValue(ScriptStr) })
            End If
        End Sub


        ' Properties
        Friend Overridable Property About As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._About
            End Get

            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.About_Click)
                If (Not Me._About Is Nothing) Then
                    RemoveHandler Me._About.Click, handler
                End If
                Me._About = WithEventsValue
                If (Not Me._About Is Nothing) Then
                    AddHandler Me._About.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property ChatMenu As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._ChatMenu
            End Get
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Me._ChatMenu = WithEventsValue
            End Set
        End Property

        Friend Overridable Property ChatOptions As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._ChatOptions
            End Get
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.ChatOptions_Click)
                If (Not Me._ChatOptions Is Nothing) Then
                    RemoveHandler Me._ChatOptions.Click, handler
                End If
                Me._ChatOptions = WithEventsValue
                If (Not Me._ChatOptions Is Nothing) Then
                    AddHandler Me._ChatOptions.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property ClearChat As ToolStripMenuItem
            Get
                Return Me._ClearChat
            End Get
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.ClearChat_Click)
                If (Not Me._ClearChat Is Nothing) Then
                    RemoveHandler Me._ClearChat.Click, handler
                End If
                Me._ClearChat = WithEventsValue
                If (Not Me._ClearChat Is Nothing) Then
                    AddHandler Me._ClearChat.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property Dataflow As ToolStripMenuItem
            Get
                Return Me._Dataflow
            End Get
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.Dataflow_Click)
                If (Not Me._Dataflow Is Nothing) Then
                    RemoveHandler Me._Dataflow.Click, handler
                End If
                Me._Dataflow = WithEventsValue
                If (Not Me._Dataflow Is Nothing) Then
                    AddHandler Me._Dataflow.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property DisablePM As ToolStripMenuItem
            Get
                Return Me._DisablePM
            End Get
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.DisablePM_Click)
                If (Not Me._DisablePM Is Nothing) Then
                    RemoveHandler Me._DisablePM.Click, handler
                End If
                Me._DisablePM = WithEventsValue
                If (Not Me._DisablePM Is Nothing) Then
                    AddHandler Me._DisablePM.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property Disconnect As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._Disconnect
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.Disconnect_Click)
                If (Not Me._Disconnect Is Nothing) Then
                    RemoveHandler Me._Disconnect.Click, handler
                End If
                Me._Disconnect = WithEventsValue
                If (Not Me._Disconnect Is Nothing) Then
                    AddHandler Me._Disconnect.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property DisplayName As ToolStripTextBox
            <DebuggerNonUserCode> _
            Get
                Return Me._DisplayName
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripTextBox)
                Me._DisplayName = WithEventsValue
            End Set
        End Property

        Friend Overridable Property DisplayNameMenu As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._DisplayNameMenu
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.DisplayNameMenu_DropDownClosed)
                If (Not Me._DisplayNameMenu Is Nothing) Then
                    RemoveHandler Me._DisplayNameMenu.DropDownClosed, handler
                End If
                Me._DisplayNameMenu = WithEventsValue
                If (Not Me._DisplayNameMenu Is Nothing) Then
                    AddHandler Me._DisplayNameMenu.DropDownClosed, handler
                End If
            End Set
        End Property

        Friend Overridable Property ExecuteStatement As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._ExecuteStatement
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.ExecuteStatement_Click)
                If (Not Me._ExecuteStatement Is Nothing) Then
                    RemoveHandler Me._ExecuteStatement.Click, handler
                End If
                Me._ExecuteStatement = WithEventsValue
                If (Not Me._ExecuteStatement Is Nothing) Then
                    AddHandler Me._ExecuteStatement.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property HelpMenu As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._HelpMenu
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Me._HelpMenu = WithEventsValue
            End Set
        End Property

        Friend Overridable Property JoinLive As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._JoinLive
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.JoinLive_Click)
                If (Not Me._JoinLive Is Nothing) Then
                    RemoveHandler Me._JoinLive.Click, handler
                End If
                Me._JoinLive = WithEventsValue
                If (Not Me._JoinLive Is Nothing) Then
                    AddHandler Me._JoinLive.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property JoinRoom As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._JoinRoom
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.JoinRoom_Click)
                If (Not Me._JoinRoom Is Nothing) Then
                    RemoveHandler Me._JoinRoom.Click, handler
                End If
                Me._JoinRoom = WithEventsValue
                If (Not Me._JoinRoom Is Nothing) Then
                    AddHandler Me._JoinRoom.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property LobbyChat As RichTextBox
            <DebuggerNonUserCode> _
            Get
                Return Me._LobbyChat
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As RichTextBox)
                Dim handler As LinkClickedEventHandler = New LinkClickedEventHandler(AddressOf Me.LobbyChat_LinkClicked)
                If (Not Me._LobbyChat Is Nothing) Then
                    RemoveHandler Me._LobbyChat.LinkClicked, handler
                End If
                Me._LobbyChat = WithEventsValue
                If (Not Me._LobbyChat Is Nothing) Then
                    AddHandler Me._LobbyChat.LinkClicked, handler
                End If
            End Set
        End Property

        Friend Overridable Property LobbyInput As TextBox
            <DebuggerNonUserCode> _
            Get
                Return Me._LobbyInput
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As TextBox)
                Dim handler As KeyPressEventHandler = New KeyPressEventHandler(AddressOf Me.LobbyInput_KeyPress)
                If (Not Me._LobbyInput Is Nothing) Then
                    RemoveHandler Me._LobbyInput.KeyPress, handler
                End If
                Me._LobbyInput = WithEventsValue
                If (Not Me._LobbyInput Is Nothing) Then
                    AddHandler Me._LobbyInput.KeyPress, handler
                End If
            End Set
        End Property

        Friend Overridable Property Login As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._Login
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.Login_Click)
                If (Not Me._Login Is Nothing) Then
                    RemoveHandler Me._Login.Click, handler
                End If
                Me._Login = WithEventsValue
                If (Not Me._Login Is Nothing) Then
                    AddHandler Me._Login.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property MenuStrip1 As MenuStrip
            <DebuggerNonUserCode> _
            Get
                Return Me._MenuStrip1
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As MenuStrip)
                Me._MenuStrip1 = WithEventsValue
            End Set
        End Property

        Private Overridable Property PingTimer As Timer
            <DebuggerNonUserCode> _
            Get
                Return Me._PingTimer
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As Timer)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.PingTimer_Tick)
                If (Not Me._PingTimer Is Nothing) Then
                    RemoveHandler Me._PingTimer.Tick, handler
                End If
                Me._PingTimer = WithEventsValue
                If (Not Me._PingTimer Is Nothing) Then
                    AddHandler Me._PingTimer.Tick, handler
                End If
            End Set
        End Property

        Friend Overridable Property PM_Mode As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._PM_Mode
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.PM_Mode_Click)
                If (Not Me._PM_Mode Is Nothing) Then
                    RemoveHandler Me._PM_Mode.Click, handler
                End If
                Me._PM_Mode = WithEventsValue
                If (Not Me._PM_Mode Is Nothing) Then
                    AddHandler Me._PM_Mode.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property ProxySettings As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._ProxySettings
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.ProxySettings_Click)
                If (Not Me._ProxySettings Is Nothing) Then
                    RemoveHandler Me._ProxySettings.Click, handler
                End If
                Me._ProxySettings = WithEventsValue
                If (Not Me._ProxySettings Is Nothing) Then
                    AddHandler Me._ProxySettings.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property ResetHandler As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._ResetHandler
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.ResetHandler_Click)
                If (Not Me._ResetHandler Is Nothing) Then
                    RemoveHandler Me._ResetHandler.Click, handler
                End If
                Me._ResetHandler = WithEventsValue
                If (Not Me._ResetHandler Is Nothing) Then
                    AddHandler Me._ResetHandler.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property SaveChat As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._SaveChat
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.SaveChat_Click)
                If (Not Me._SaveChat Is Nothing) Then
                    RemoveHandler Me._SaveChat.Click, handler
                End If
                Me._SaveChat = WithEventsValue
                If (Not Me._SaveChat Is Nothing) Then
                    AddHandler Me._SaveChat.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property ScriptMenu As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._ScriptMenu
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Me._ScriptMenu = WithEventsValue
            End Set
        End Property

        Friend Overridable Property ShowData As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._ShowData
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.ShowData_Click)
                If (Not Me._ShowData Is Nothing) Then
                    RemoveHandler Me._ShowData.Click, handler
                End If
                Me._ShowData = WithEventsValue
                If (Not Me._ShowData Is Nothing) Then
                    AddHandler Me._ShowData.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property SplitContainer1 As SplitContainer
            <DebuggerNonUserCode> _
            Get
                Return Me._SplitContainer1
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As SplitContainer)
                Me._SplitContainer1 = WithEventsValue
            End Set
        End Property

        Friend Overridable Property SplitContainer2 As SplitContainer
            <DebuggerNonUserCode> _
            Get
                Return Me._SplitContainer2
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As SplitContainer)
                Me._SplitContainer2 = WithEventsValue
            End Set
        End Property

        Friend Overridable Property Status As ToolStripStatusLabel
            <DebuggerNonUserCode> _
            Get
                Return Me._Status
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripStatusLabel)
                Me._Status = WithEventsValue
            End Set
        End Property

        Friend Overridable Property StatusStrip1 As StatusStrip
            <DebuggerNonUserCode> _
            Get
                Return Me._StatusStrip1
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As StatusStrip)
                Me._StatusStrip1 = WithEventsValue
            End Set
        End Property

        Friend Overridable Property StickamMenu As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._StickamMenu
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Me._StickamMenu = WithEventsValue
            End Set
        End Property

        Private Overridable Property StickamStream As StickamRtmp
            <DebuggerNonUserCode> _
            Get
                Return Me._StickamStream
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As StickamRtmp)
                Dim handler As HandshakeReplyEventHandler = New HandshakeReplyEventHandler(AddressOf Me.StickamStream_HandshakeReply)
                Dim handler2 As DataArrivalEventHandler = New DataArrivalEventHandler(AddressOf Me.StickamStream_DataArrival)
                Dim handler3 As ConnectedEventHandler = New ConnectedEventHandler(AddressOf Me.StickamStream_Connected)
                Dim handler4 As ClosedEventHandler = New ClosedEventHandler(AddressOf Me.StickamStream_Closed)
                If (Not Me._StickamStream Is Nothing) Then
                    RemoveHandler Me._StickamStream.HandshakeReply, handler
                    RemoveHandler Me._StickamStream.DataArrival, handler2
                    RemoveHandler Me._StickamStream.Connected, handler3
                    RemoveHandler Me._StickamStream.Closed, handler4
                End If
                Me._StickamStream = WithEventsValue
                If (Not Me._StickamStream Is Nothing) Then
                    AddHandler Me._StickamStream.HandshakeReply, handler
                    AddHandler Me._StickamStream.DataArrival, handler2
                    AddHandler Me._StickamStream.Connected, handler3
                    AddHandler Me._StickamStream.Closed, handler4
                End If
            End Set
        End Property

        Private Overridable Property StickamWeb As StickamHttp
            <DebuggerNonUserCode> _
            Get
                Return Me._StickamWeb
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As StickamHttp)
                Dim handler As RoomIPRetrievedEventHandler = New RoomIPRetrievedEventHandler(AddressOf Me.StickamWeb_RoomIPRetrieved)
                Dim handler2 As LoggedInEventHandler = New LoggedInEventHandler(AddressOf Me.StickamWeb_LoggedIn)
                Dim handler3 As HostIDRetrievedEventHandler = New HostIDRetrievedEventHandler(AddressOf Me.StickamWeb_HostIDRetrieved)
                Dim handler4 As RoomlistRetrievedEventHandler = New RoomlistRetrievedEventHandler(AddressOf Me.StickamWeb_RoomlistRetrieved)
                If (Not Me._StickamWeb Is Nothing) Then
                    RemoveHandler Me._StickamWeb.RoomIPRetrieved, handler
                    RemoveHandler Me._StickamWeb.LoggedIn, handler2
                    RemoveHandler Me._StickamWeb.HostIDRetrieved, handler3
                    RemoveHandler Me._StickamWeb.RoomlistRetrieved, handler4
                End If
                Me._StickamWeb = WithEventsValue
                If (Not Me._StickamWeb Is Nothing) Then
                    AddHandler Me._StickamWeb.RoomIPRetrieved, handler
                    AddHandler Me._StickamWeb.LoggedIn, handler2
                    AddHandler Me._StickamWeb.HostIDRetrieved, handler3
                    AddHandler Me._StickamWeb.RoomlistRetrieved, handler4
                End If
            End Set
        End Property

        Private Overridable Property TimeoutTimer As Timer
            <DebuggerNonUserCode> _
            Get
                Return Me._TimeoutTimer
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As Timer)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.TimeoutTimer_Tick)
                If (Not Me._TimeoutTimer Is Nothing) Then
                    RemoveHandler Me._TimeoutTimer.Tick, handler
                End If
                Me._TimeoutTimer = WithEventsValue
                If (Not Me._TimeoutTimer Is Nothing) Then
                    AddHandler Me._TimeoutTimer.Tick, handler
                End If
            End Set
        End Property

        Friend Overridable Property ToolStripSeparator1 As ToolStripSeparator
            <DebuggerNonUserCode> _
            Get
                Return Me._ToolStripSeparator1
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripSeparator)
                Me._ToolStripSeparator1 = WithEventsValue
            End Set
        End Property

        Friend Overridable Property ToolStripSeparator2 As ToolStripSeparator
            <DebuggerNonUserCode> _
            Get
                Return Me._ToolStripSeparator2
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripSeparator)
                Me._ToolStripSeparator2 = WithEventsValue
            End Set
        End Property

        Friend Overridable Property ToolStripSeparator3 As ToolStripSeparator
            <DebuggerNonUserCode> _
            Get
                Return Me._ToolStripSeparator3
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripSeparator)
                Me._ToolStripSeparator3 = WithEventsValue
            End Set
        End Property

        Friend Overridable Property ToolStripSeparator4 As ToolStripSeparator
            <DebuggerNonUserCode> _
            Get
                Return Me._ToolStripSeparator4
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripSeparator)
                Me._ToolStripSeparator4 = WithEventsValue
            End Set
        End Property

        Friend Overridable Property ToolStripSeparator5 As ToolStripSeparator
            <DebuggerNonUserCode> _
            Get
                Return Me._ToolStripSeparator5
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripSeparator)
                Me._ToolStripSeparator5 = WithEventsValue
            End Set
        End Property

        Friend Overridable Property UserlistCtl As TreeView
            <DebuggerNonUserCode> _
            Get
                Return Me._UserlistCtl
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As TreeView)
                Dim handler As TreeNodeMouseClickEventHandler = New TreeNodeMouseClickEventHandler(AddressOf Me.UserlistCtl_NodeMouseClick)
                Dim handler2 As TreeViewEventHandler = New TreeViewEventHandler(AddressOf Me.UserlistCtl_AfterSelect)
                If (Not Me._UserlistCtl Is Nothing) Then
                    RemoveHandler Me._UserlistCtl.NodeMouseClick, handler
                    RemoveHandler Me._UserlistCtl.AfterSelect, handler2
                End If
                Me._UserlistCtl = WithEventsValue
                If (Not Me._UserlistCtl Is Nothing) Then
                    AddHandler Me._UserlistCtl.NodeMouseClick, handler
                    AddHandler Me._UserlistCtl.AfterSelect, handler2
                End If
            End Set
        End Property

        Friend Overridable Property UserMenu As ContextMenuStrip
            <DebuggerNonUserCode> _
            Get
                Return Me._UserMenu
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ContextMenuStrip)
                Dim handler As CancelEventHandler = New CancelEventHandler(AddressOf Me.UserMenu_Opening)
                If (Not Me._UserMenu Is Nothing) Then
                    RemoveHandler Me._UserMenu.Opening, handler
                End If
                Me._UserMenu = WithEventsValue
                If (Not Me._UserMenu Is Nothing) Then
                    AddHandler Me._UserMenu.Opening, handler
                End If
            End Set
        End Property

        Friend Overridable Property UserMenu_GetUserInfo As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._UserMenu_GetUserInfo
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.UserMenu_GetUserInfo_Click)
                If (Not Me._UserMenu_GetUserInfo Is Nothing) Then
                    RemoveHandler Me._UserMenu_GetUserInfo.Click, handler
                End If
                Me._UserMenu_GetUserInfo = WithEventsValue
                If (Not Me._UserMenu_GetUserInfo Is Nothing) Then
                    AddHandler Me._UserMenu_GetUserInfo.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property UserMenu_IgnoreUser As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._UserMenu_IgnoreUser
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.UserMenu_IgnoreUser_Click)
                If (Not Me._UserMenu_IgnoreUser Is Nothing) Then
                    RemoveHandler Me._UserMenu_IgnoreUser.Click, handler
                End If
                Me._UserMenu_IgnoreUser = WithEventsValue
                If (Not Me._UserMenu_IgnoreUser Is Nothing) Then
                    AddHandler Me._UserMenu_IgnoreUser.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property UserMenu_KickUser As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._UserMenu_KickUser
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.UserMenu_KickUser_Click)
                If (Not Me._UserMenu_KickUser Is Nothing) Then
                    RemoveHandler Me._UserMenu_KickUser.Click, handler
                End If
                Me._UserMenu_KickUser = WithEventsValue
                If (Not Me._UserMenu_KickUser Is Nothing) Then
                    AddHandler Me._UserMenu_KickUser.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property UserMenu_MakeModerator As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._UserMenu_MakeModerator
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.UserMenu_MakeModerator_Click)
                If (Not Me._UserMenu_MakeModerator Is Nothing) Then
                    RemoveHandler Me._UserMenu_MakeModerator.Click, handler
                End If
                Me._UserMenu_MakeModerator = WithEventsValue
                If (Not Me._UserMenu_MakeModerator Is Nothing) Then
                    AddHandler Me._UserMenu_MakeModerator.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property UserMenu_SendMessage As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._UserMenu_SendMessage
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.UserMenu_SendMessage_Click)
                If (Not Me._UserMenu_SendMessage Is Nothing) Then
                    RemoveHandler Me._UserMenu_SendMessage.Click, handler
                End If
                Me._UserMenu_SendMessage = WithEventsValue
                If (Not Me._UserMenu_SendMessage Is Nothing) Then
                    AddHandler Me._UserMenu_SendMessage.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property UserMenu_StealFont As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._UserMenu_StealFont
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.UserMenu_StealFont_Click)
                If (Not Me._UserMenu_StealFont Is Nothing) Then
                    RemoveHandler Me._UserMenu_StealFont.Click, handler
                End If
                Me._UserMenu_StealFont = WithEventsValue
                If (Not Me._UserMenu_StealFont Is Nothing) Then
                    AddHandler Me._UserMenu_StealFont.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property UserMenu_StealFontName As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._UserMenu_StealFontName
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.UserMenu_StealFontName_Click)
                If (Not Me._UserMenu_StealFontName Is Nothing) Then
                    RemoveHandler Me._UserMenu_StealFontName.Click, handler
                End If
                Me._UserMenu_StealFontName = WithEventsValue
                If (Not Me._UserMenu_StealFontName Is Nothing) Then
                    AddHandler Me._UserMenu_StealFontName.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property UserMenu_StealName As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._UserMenu_StealName
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.UserMenu_StealName_Click)
                If (Not Me._UserMenu_StealName Is Nothing) Then
                    RemoveHandler Me._UserMenu_StealName.Click, handler
                End If
                Me._UserMenu_StealName = WithEventsValue
                If (Not Me._UserMenu_StealName Is Nothing) Then
                    AddHandler Me._UserMenu_StealName.Click, handler
                End If
            End Set
        End Property

        Friend Overridable Property UserMenu_ViewProfile As ToolStripMenuItem
            <DebuggerNonUserCode> _
            Get
                Return Me._UserMenu_ViewProfile
            End Get
            <MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
            Set(ByVal WithEventsValue As ToolStripMenuItem)
                Dim handler As EventHandler = New EventHandler(AddressOf Me.UserMenu_ViewProfile_Click)
                If (Not Me._UserMenu_ViewProfile Is Nothing) Then
                    RemoveHandler Me._UserMenu_ViewProfile.Click, handler
                End If
                Me._UserMenu_ViewProfile = WithEventsValue
                If (Not Me._UserMenu_ViewProfile Is Nothing) Then
                    AddHandler Me._UserMenu_ViewProfile.Click, handler
                End If
            End Set
        End Property


        ' Fields
        <AccessedThroughProperty("About")> _
        Private _About As ToolStripMenuItem
        <AccessedThroughProperty("ChatMenu")> _
        Private _ChatMenu As ToolStripMenuItem
        <AccessedThroughProperty("ChatOptions")> _
        Private _ChatOptions As ToolStripMenuItem
        <AccessedThroughProperty("ClearChat")> _
        Private _ClearChat As ToolStripMenuItem
        <AccessedThroughProperty("Dataflow")> _
        Private _Dataflow As ToolStripMenuItem
        <AccessedThroughProperty("DisablePM")> _
        Private _DisablePM As ToolStripMenuItem
        <AccessedThroughProperty("Disconnect")> _
        Private _Disconnect As ToolStripMenuItem
        <AccessedThroughProperty("DisplayName")> _
        Private _DisplayName As ToolStripTextBox
        <AccessedThroughProperty("DisplayNameMenu")> _
        Private _DisplayNameMenu As ToolStripMenuItem
        <AccessedThroughProperty("ExecuteStatement")> _
        Private _ExecuteStatement As ToolStripMenuItem
        <AccessedThroughProperty("HelpMenu")> _
        Private _HelpMenu As ToolStripMenuItem
        <AccessedThroughProperty("JoinLive")> _
        Private _JoinLive As ToolStripMenuItem
        <AccessedThroughProperty("JoinRoom")> _
        Private _JoinRoom As ToolStripMenuItem
        <AccessedThroughProperty("LobbyChat")> _
        Private _LobbyChat As RichTextBox
        <AccessedThroughProperty("LobbyInput")> _
        Private _LobbyInput As TextBox
        <AccessedThroughProperty("Login")> _
        Private _Login As ToolStripMenuItem
        <AccessedThroughProperty("MenuStrip1")> _
        Private _MenuStrip1 As MenuStrip
        <AccessedThroughProperty("PingTimer")> _
        Private _PingTimer As Timer
        <AccessedThroughProperty("PM_Mode")> _
        Private _PM_Mode As ToolStripMenuItem
        <AccessedThroughProperty("ProxySettings")> _
        Private _ProxySettings As ToolStripMenuItem
        <AccessedThroughProperty("ResetHandler")> _
        Private _ResetHandler As ToolStripMenuItem
        <AccessedThroughProperty("SaveChat")> _
        Private _SaveChat As ToolStripMenuItem
        <AccessedThroughProperty("ScriptMenu")> _
        Private _ScriptMenu As ToolStripMenuItem
        <AccessedThroughProperty("ShowData")> _
        Private _ShowData As ToolStripMenuItem
        <AccessedThroughProperty("SplitContainer1")> _
        Private _SplitContainer1 As SplitContainer
        <AccessedThroughProperty("SplitContainer2")> _
        Private _SplitContainer2 As SplitContainer
        <AccessedThroughProperty("Status")> _
        Private _Status As ToolStripStatusLabel
        <AccessedThroughProperty("StatusStrip1")> _
        Private _StatusStrip1 As StatusStrip
        <AccessedThroughProperty("StickamMenu")> _
        Private _StickamMenu As ToolStripMenuItem
        <AccessedThroughProperty("StickamStream")> _
        Private _StickamStream As StickamRtmp
        <AccessedThroughProperty("StickamWeb")> _
        Private _StickamWeb As StickamHttp
        <AccessedThroughProperty("TimeoutTimer")> _
        Private _TimeoutTimer As Timer
        <AccessedThroughProperty("ToolStripSeparator1")> _
        Private _ToolStripSeparator1 As ToolStripSeparator
        <AccessedThroughProperty("ToolStripSeparator2")> _
        Private _ToolStripSeparator2 As ToolStripSeparator
        <AccessedThroughProperty("ToolStripSeparator3")> _
        Private _ToolStripSeparator3 As ToolStripSeparator
        <AccessedThroughProperty("ToolStripSeparator4")> _
        Private _ToolStripSeparator4 As ToolStripSeparator
        <AccessedThroughProperty("ToolStripSeparator5")> _
        Private _ToolStripSeparator5 As ToolStripSeparator
        <AccessedThroughProperty("UserlistCtl")> _
        Private _UserlistCtl As TreeView
        <AccessedThroughProperty("UserMenu")> _
        Private _UserMenu As ContextMenuStrip
        <AccessedThroughProperty("UserMenu_GetUserInfo")> _
        Private _UserMenu_GetUserInfo As ToolStripMenuItem
        <AccessedThroughProperty("UserMenu_IgnoreUser")> _
        Private _UserMenu_IgnoreUser As ToolStripMenuItem
        <AccessedThroughProperty("UserMenu_KickUser")> _
        Private _UserMenu_KickUser As ToolStripMenuItem
        <AccessedThroughProperty("UserMenu_MakeModerator")> _
        Private _UserMenu_MakeModerator As ToolStripMenuItem
        <AccessedThroughProperty("UserMenu_SendMessage")> _
        Private _UserMenu_SendMessage As ToolStripMenuItem
        <AccessedThroughProperty("UserMenu_StealFont")> _
        Private _UserMenu_StealFont As ToolStripMenuItem
        <AccessedThroughProperty("UserMenu_StealFontName")> _
        Private _UserMenu_StealFontName As ToolStripMenuItem
        <AccessedThroughProperty("UserMenu_StealName")> _
        Private _UserMenu_StealName As ToolStripMenuItem
        <AccessedThroughProperty("UserMenu_ViewProfile")> _
        Private _UserMenu_ViewProfile As ToolStripMenuItem
        Private components As IContainer
        Private DelegateThread As ParamsDelegate
        Private ExecuteAllow As String
        Private FailSafe As String
        Private FailSafe2 As String
        Private Keywords As String()
        Public MyVars As VarsClass
        Private PrivateMessages As String()
        Public Roomlist As RoomlistClass
        Private SaveFileDlg As SaveFileDialog
        Public ScriptControl As Object
        Public ShowingData As Boolean
        Private TimeoutCode As String
        Private UserIconList As ImageList
        Private UserIconListInverted As ImageList
        Public Userlist As UserlistClass
        Public WebpageScript As Object
        Public XX As String

        ' Nested Types
        Public Delegate Sub FontUpdatedEventHandler()

        Public Delegate Sub NewPrivateMessageEventHandler(ByVal userID As String, ByVal msg As String, ByVal font As String, ByVal fontColor As String, ByVal fontSize As Integer, ByVal isBold As Boolean, ByVal isItalics As Boolean, ByVal isUnderline As Boolean)

        Private Delegate Sub ParamsDelegate(ByVal CallType As String, ByVal Param As Object)

        Public Delegate Sub RoomlistRetrievedEventHandler(ByVal IsSuccess As Boolean)

        Private Delegate Sub ST(ByVal vCode As String, ByVal iMilliseconds As Integer)
    End Class
End Namespace

